package com.bkhech.netty.httpwebsocket.server;

import io.netty.channel.group.ChannelGroup;
import io.netty.channel.group.DefaultChannelGroup;
import io.netty.util.concurrent.GlobalEventExecutor;

/**
 * ClientChannelGroup
 *
 * @author guowm
 * @date 2024-11-11
 */
public class ClientChannelGroup {
    private static volatile ChannelGroup clients;

    private ClientChannelGroup() {
    }

    public static ChannelGroup getInstance() {
        if (clients == null) {
            synchronized (ClientChannelGroup.class) {
                if (clients == null) {
                    clients = new DefaultChannelGroup(GlobalEventExecutor.INSTANCE);
                }
            }
        }
        return clients;
    }
}
